package com.zzjson.spring;

import org.springframework.context.support.ReloadableResourceBundleMessageSource;

import java.util.Locale;

/**
 * <p>****************************************************************************</p>
 * <p><b>Copyright © 2010-2020 shuncom team All Rights Reserved<b></p>
 * <ul style="margin:15px;">
 * <li>Description : com.zzjson.spring</li>
 * <li>Version     : 1.0.0</li>
 * <li>Creation    : 2020年04月08日</li>
 * <li>@author     : zzy0_0</li>
 * </ul>
 * <p>****************************************************************************</p>
 */
public class SpringI18nDemo {
	public static final String BUNDLE_NAME = "demo";

	public static void main(String[] args) {
		// ResourceBundle + MessageFormat => MessageSource
		// ResourceBundleMessageSource 不能重载
		// ReloadableResourceBundleMessageSource
		ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
		messageSource.setDefaultEncoding("utf-8");
		messageSource.setBasename(BUNDLE_NAME);
		String name = messageSource
				.getMessage("world", new Object[]{"World"}, Locale.SIMPLIFIED_CHINESE);
		System.out.println(name);
	}
}
